home *** CD-ROM | disk | FTP | other *** search
/ SGI ONC3 NFS v2 / SGI ONC3 NFS v2.iso / dist6.4 / nfs.idb / etc / init.d / dlif.z / dlif
Text File  |  1997-02-07  |  2KB  |  77 lines

  1. #!/bin/sh
  2. #
  3. # Start and stop diskless interface with local /unix
  4. #
  5. # Copyright 1988-1991 Silicon Graphics, Inc.
  6. # All rights reserved.
  7. #
  8. # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  9. # the contents of this file may not be disclosed to third parties, copied or
  10. # duplicated in any form, in whole or in part, without the prior written
  11. # permission of Silicon Graphics, Inc.
  12. #
  13. # RESTRICTED RIGHTS LEGEND:
  14. # Use, duplication or disclosure by the Government is subject to restrictions
  15. # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  16. # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  17. # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  18. # rights reserved under the Copyright Laws of the United States.
  19.  
  20. # This script is for pseudo-diskless mode support.
  21. # It keeps the local copy of the kernel in sync with the /unix provided by
  22. # the file server.
  23.  
  24. IS_ON=/etc/chkconfig
  25. CP=cp
  26.  
  27. if $IS_ON verbose ; then
  28.     ECHO=echo
  29. else
  30.     ECHO=:
  31. fi
  32.  
  33. case "$1" in
  34. 'start')
  35.     ;;
  36. 'stop')
  37.     if test "`/sbin/nvram diskless 2>/dev/null`" -ne 1 -o \
  38.     "`/sbin/nvram dlif 2>/dev/null`" = ""; then
  39.     exit 0
  40.     fi
  41.  
  42.     # Map the ARCS filespec (scsi(x)disk(y)rdisk(0)partition(z)) to
  43.     # the Irix filespec (/dev/dsk/dksxdysz)
  44.     PARTITION=`/sbin/nvram OSLoadPartition | \
  45.     /sbin/sed -e 's_scsi(_/dev/dsk/dks_' \
  46.     -e 's_)disk(_d_' -e 's_)rdisk(0)partition(_s_' -e 's_)__'`
  47.  
  48.     # Make sure this partition is mounted
  49.     MNTPT=`/sbin/mount | /sbin/grep $PARTITION | /usr/bin/awk '{print $3}'`
  50.     if test "$MNTPT" = ""; then
  51.     $ECHO "dlif: Couldn't check local bootfile: $PARTITION is not mounted"
  52.     exit 1
  53.     else
  54.     BOOTFILE=`/sbin/nvram OSLoadFilename`
  55.     if test -x /unix.install; then
  56.  
  57.         # Copy /unix.install if one exists.
  58.         $ECHO "dlif: Updating local bootfile ($MNTPT$BOOTFILE)"
  59.         $CP /unix.install $MNTPT$BOOTFILE
  60.  
  61.     elif test ! -x $MNTPT$BOOTFILE; then
  62.         # Copy /unix if the local bootfile doesn't exist (which would be the case
  63.         # if we've just turned dlif on
  64.         if test -x /unix; then
  65.         $ECHO "dlif: Installing local bootfile ($MNTPT$BOOTFILE)"
  66.         $CP /unix $MNTPT$BOOTFILE
  67.  
  68.         else
  69.         # Neither /unix or the local bootfile exist!  This is serious, the 
  70.         # machine may not be able to reboot.
  71.         echo "dlif: WARNING: Could not create local bootfile ($MNTPT$BOOTFILE)"
  72.         fi
  73.     fi
  74.     fi
  75.     ;;
  76. esac
  77.